package com.design.pattern.iterator;
import java.util.ArrayList;
import java.util.Iterator;

public class Waitress {
//    PancakeHouseMenu pancakeHouseMenu;
//    DinerMenu dinerMenu;

    ArrayList menuItems;

    public Waitress(ArrayList menuItems) {
        this.menuItems = menuItems;
    }

    public void printMenu() {

        Iterator iterator = menuItems.iterator();
        while (iterator.hasNext()){
            Menu menu = (Menu) iterator.next();
            Iterator menuIterator = menu.createIterator();
            printMenu(menuIterator);
        }
       /*
        Iterator pancakeHouseMenuIterator = pancakeHouseMenu.createIterator();
        Iterator dinerMenuIterator = dinerMenu.createIterator();

        System.out.println("Menu\n----\nBREAKFAST");
        printMenu(pancakeHouseMenuIterator);

        System.out.println("\nLUNCH");
        printMenu(dinerMenuIterator);*/
    }


    private void printMenu(Iterator iterator) {
        while (iterator.hasNext()) {
            MenuItem menuItem = (MenuItem) iterator.next();
            System.out.print(menuItem.getName() + ",");
            System.out.print(menuItem.getPrice() + "--");
            System.out.println(menuItem.getDescription() + ";");
        }
    }
}